import { createRouter, createWebHistory } from "vue-router";

//  路由组件动态引入
const Layout = ()=> import('@/layout/index.vue')
// const home = () => import('@/view/home.vue')
const routes:any[] = [
  {
    path:'/',
    redirect: '/home',
    component: Layout,
    children:[
      {
        path: '/home',
        component: () => import('@/view/home.vue'),
        name: 'home',
        meta: {
          title: '首页'
        }
      },
      {
        path: '/:catchAll(.*)',
        component: ()=> import('@/view/404.vue'),
        name: '404',
        meta: {
          title: '首页'
        }
      }
    ]
  }
]


// 挂载路由
const router = createRouter({
  history: createWebHistory(),
  routes,

})
// 导出全局使用
export default router